<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>产品库存列表</title>
		<meta name="viewport" content=" height=device-height,
			          width=device-width,
			          initial-scale=1.0,
			          minimum-scale=1.0,
			          maximum-scale=1.0
			          user-scalable=no" />
		<link rel="stylesheet" href="../css/proStock.css">
		<script src="http://apps.bdimg.com/libs/jquery/1.9.1/jquery.min.js"></script>
		<script>
			$(function() {
				var userId = localStorage.getItem("userId");
				var token = localStorage.getItem("token");
				var ip = localStorage.getItem("ip");
//				var ip = 'http://192.168.1.104:8080/wxs/wx/';
				$.ajax({
					type: 'post', //类型
					url: ip + 'product/supplist', //请求路径
					contentType: 'application/x-www-form-urlencoded', //默认
					dataType: 'json', //返回数据类型  可以是text：字符串  可以是json：json对象
					data: {
						'userId': userId,
						'token': token,
					}, //数据
					success: function(result) {
						if(result.code == 200) {
							for(var Key in result.data) {
								var proId = result.data[Key].proId;
								var proName = result.data[Key].proName;
								var proSellerNum = result.data[Key].proSellerNum;
								var proPicture = result.data[Key].proPicture;
								var stock = result.data[Key].stock - result.data[Key].unstock;
								var productModel = result.data[Key].productModel;
								var unstock = result.data[Key].unstock;
								var arr;
								if(proPicture == null) {
									arr ="http://39.108.187.126:8080/nop.png";
								} else {
									arr = proPicture.split(',')[0];
								}
                                var txts = '<tr onclick=' + 'getFileFull(' + proId + '); >';
								txts = txts + '<td colspan="2" rowspan="5" width="1%"  style=" border: 5px solid;border-color:white; border-left: none;border-top:none;border-right:none; font-size: calc(10vw/3.75); background: #c9daf8; color: #c9daf8;  border-left: none;border-top:none;border-right:none;">产品</td>';
								txts = txts + '<td width="32%" colspan="2" style="font-size: calc(15vw/3.75);border:none;text-overflow:ellipsis">'  +proSellerNum +'&nbsp;&nbsp;&nbsp;'+ proName+'&nbsp;&nbsp;&nbsp;'+productModel+'</td></tr>';
								txts = txts + '<tr onclick=' + 'getFileFull(' + proId + ');>';
								txts = txts + '<td width="5%" style="border:none;">总&nbsp;库&nbsp;存&nbsp;数&nbsp;量：</td>';
								txts = txts + '<td style="border:none;">' + result.data[Key].stock + '</td> </tr>';
								txts = txts + '<tr onclick=' + 'getFileFull(' + proId + ');>';
								txts = txts + '<td width="5%" style="border:none;">良品库存数量：</td>';
								txts = txts + '<td style="border:none;">' + stock + '</td> </tr>';
								txts = txts + '<tr style="color: red; "  onclick=' + 'getFileFull(' + proId + ');>';
								txts = txts + '<td width="5%"style="border-right:none; border-top:none;border-left: none;">不良库存数量：</td>';
								txts = txts + '<td style="border-left: none;border-top:none;border-right:none;">' + unstock + '</td>';
								txts = txts + '<tr style="color: #c9daf8; background: #c9daf8;">';
								txts = txts + '<td width="5%" style=" border: 5px solid; border-color:white; border-left: none;border-top:none;border-right:none;font-size: calc(1vw/3.75);">不良库存数量：</td>';
								txts = txts + '<td style="border-left: none;border-top:none;border-right:none; border-color:white;"></td></tr>';
								$(".pro-ta").append(txts);

							}
						} else {
							alert('获取数据异常,请重新登录');
							//window.location.href='Login.html';
						}
					},
					error: function(data) { //若果传过来的数据为空
					}
				});
			});

			function getFileFull(id) {
				localStorage.setItem("proId", id);
				window.location.href = 'proStockDetails.html';
			}
		</script>
	</head>

	<body>
		<div style="margin-left: 5%;display:none;">
			<font>搜索 </font>
			<input type="text" style="height: 35px;margin-bottom: 5px;width: 70%; -webkit-border-radius: 10px;" />
			<span style="background:url(../img/search.png);line-height: 28px;position: absolute;left: 83%;top: 1%;width: 35px;height: 35px"></span>
		</div>
		<div style="color: #c9daf8; background: #c9daf8; width: 100%;font-size: calc(10vw/3.75);">
			<font>sdsdssd </font>
		</div>
		<table width="100%" class="pro-ta" border="1"  style=" border-collapse: collapse; border:none;">
		</table>
	</body>

</html>